import { throttle as _throttle } from 'lodash'

export default {
  data() {
    return {
      onResizeWithThrottle: _throttle(this.onResize, 100)
    }
  },
  mounted() {
    // 监听resize事件(使用_throttle防止resize事件多次触发)
    window.addEventListener('resize', this.onResizeWithThrottle)
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.onResizeWithThrottle)
  },
  methods: {
    onResize() {}
  }
}
